Csv plugin example
Kanzi uses gettext's .po file format for handling localized text resources. See The Format of PO Files. To use a different format for importing and exporting localized text resources, you can use the Kanzi Localization Plugin API to create a Kanzi Studio plugin that supports the format based on your specifications. You can find an example of such plugin in the <KanziWorkspace>/Examples/CsvPlugin directory.
When you import localized content with the CSV plugin:
- Ignores the content of the first two cells in the first two columns (the ResourceID and the Default Text).
- Ignores the changes to the Default Text column for existing resource IDs.
- Imports the content with resource IDs that do not yet exist in the localization table.
The Localization Plugin API is written in .NET 4.0 and the CsvPlugin example plugin is written in C#. See Localization plugin API reference.
The CsvPlugin example directory contains:
- bin directory contains the Kanzi Studio plugin created from the CsvPlugin.sln example Visual Studio solution.
- lib contains the library dependencies for creating localization plugins.
- Properties contains a file with the plugin .dll metadata, such as version information.
- Src contains the source files used in the CsvPlugin.sln solution for the example plugin.
- CsvPlugin.sln is a Visual Studio solution that implements the Kanzi Studio plugin you can use to import and export localized text resources using .csv files.
Importing and exporting localized text resources using a custom file format
To import and export localized text resources using a custom file format:
- Create a plugin using the Kanzi Localization Plugin API. You can find the reference documentation for the Kanzi Localization Plugin API in the <KanziWorkspace>/Examples/CsvPlugin/docs directory.
For an example plugin that enables you to import and export localized text resources in .csv file format, open the <KanziWorkspace>/Examples/CsvPlugin/CsvPlugin.sln example in Visual Studio.
- When you are done writing your plugin, create the plugin .dll, and copy the plugin .dll to the %ProgramData%/Rightware/<KanziVersion>/plugins directory on your computer. If the plugins directory does not already exist there, create it.
For example, if you are using the example CsvPlugin.sln solution, when you are done writing the plugin:- You can build the plugin without the Visual Studio using the Microsoft Windows SDK for Windows 7 and .NET Framework 4. In the Windows command line run the MSBuild.exe in the directory that contains the Visual Studio solution for your plugin.
Or- In Visual Studio Solution Explorer right-click the CsvPlugin project and select Build.
The CsvPlugin.sln solution is configured to create the plugin .dll in <KanziWorkspace>/Examples/CsvPlugin/bin.
- Open Kanzi Studio and open an existing or create a new project. If you already have Kanzi Studio opened, restart it to load your plugin the first time.
- If Kanzi Studio successfully loads your plugin, in the Library right-click any localization table and in the context menu select the commands you added with the plugin.
For example, if you use the CsvPlugin example plugin .dll, the plugin adds context menu commands Export CSV and Import CSV.
- When you make changes to your plugin, after creating the .dll and copying the plugin .dll to the %ProgramData%/Rightware/<KanziVersion>/plugins directory, restart Kanzi Studio to take the newer version of the plugin into use.
See also
Localization plugin API reference
Localization
Kanzi Studio plugins
Examples
Open topic with navigation